﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <script src="../../js/header.js"></script>
</head>
<body>
    <div class="data-wrap case">
        <div class="data-tool clearfix">
            <div class="pull-left form-inline ">
                <a class="btn btn-default" data-modal="/view/permission/add.html" data-title="新增" data-width="452" data-height="177"><span class="glyphicon glyphicon-plus"></span> 新增</a>
            </div>
            <div class="pull-right">
                <form class="form-inline" id="formSearch">

                    <div class="input-group">
                        <label class="input-group-addon m5_l">权限名称：</label>
                        <input class="form-control" name="pName" type="text" autocomplete="off">
                    </div>

                    <div class="input-group">
                        <label class="input-group-addon m5_l">权限代码：</label>
                        <input class="form-control" name="pCode" type="text" autocomplete="off">
                    </div>

                    <button type="button" class="btn btn-default m5_1" id="btnSearch" onclick="return doSearch();"><span class="glyphicon glyphicon-search"></span> 搜索</button>
                </form>
            </div>
        </div>
        <div class="paging">
        </div>
    </div>
    <script type="text/x-dot-template" id="permissionPagerTemplate">
        <div class="data-head table-responsive">
            <table class="table">
                <thead>
                    <tr>
                        <th class="t_l">权限名称</th>
                        <th width="200">权限代码</th>
                        <th width="100">状态</th>
                        <th width="130">操作</th>
                    </tr>
                </thead>
            </table>
        </div>

        <div class="data-body data-scroll">
            <div class="data-div-view">
                <table class="table table-hover">
                    <tbody>
                        {{? it.tData && it.tData.length>0}}
                            {{~it.tData :item:index}}
                            <tr>
                                <td class="t_l">{{= item.pName }}</td>
                                <td width="200">{{= item.pCode }}</td>
                                <td width="100">
                                    {{? item.hide==1 }}
                                    <span class="green bold">启用</span>
                                    {{?? }}
                                    <span class="red bold">禁用</span>
                                    {{? }}
                                </td>
                                <td width="130">
                                    {{? item.hide==1 }}
                                    <a class="btn btn-warning" data-confirm='"{{= item.pName }}" <br>确定要<span class="orange">禁用</span>该角色？' data-href="/Permission/UpdateStatus?id={{= item.pid}}&status=2">禁用</a>
                                    {{?? }}
                                    <a class="btn btn-success" data-confirm='"{{= item.pName }}" <br>确定要<span class="green">启用</span>该角色？' data-href="/Permission/UpdateStatus?id={{= item.pid}}&status=1">启用</a>
                                    {{? }}
                                    <button type="button" class="btn btn-default" data-modal="/view/permission/edit.html?id={{= item.pid}}" data-title="编辑 - {{= item.pName }}" data-width="452" data-height="177">
                                        <span class="glyphicon glyphicon-edit"></span> 编辑
                                    </button>
                                </td>
                            </tr>
                            {{~}}
                        {{??}}
                            <tr class="noRecord">
                                <td colspan="4">暂无记录！</td>
                            </tr>
                        {{?}}
                    </tbody>
                </table>
            </div>
        </div>
        <!-- 必要的分页参数设置 -->
        <input type="hidden" id="TotalCount" value="{{=it.totalCount}}" />
    </script>
    <script type="text/javascript">
        //菜单状态
        var menuStatus ={
            show: 1,
            hide: 2
        };
        $(function () {
            doSearch();
        });

        function Tip_success(word) {

            FlashPay.UI.Tip_success(word);
        }

        function doSearch() {
            FlashPay.UI.Pager(".paging", { templateId: "permissionPagerTemplate", ajax: { url: '/Permission/GetPager'} });
        }

        $(document).keyup(function (event) {
            var keycode = event.which;
            if (keycode == 13) {
                doSearch();
            }
        }); 
    </script>
</body>
</html>